home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: These string questions just won't go away......
- Date: Tue, 02 Jan 96 00:33:33 GMT
- Organization: none
- Message-ID: <820542813snz@genesis.demon.co.uk>
- References: <4c67g1$k88@news1.usa.pipeline.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4c67g1$k88@news1.usa.pipeline.com>
- grantp@usa.pipeline.com(Pete) "Pete" writes:
-
- >On Dec 30, 1995 02:21:50 in article <These string questions just won't go
- >away......>, 'aldo@tribeca.ios.com (Aldo Di Domenico)' wrote:
- >
- >>void
- >>f(char *input)
- >>{
- >>input--;
- >>printf(*input);
- >
- >This should cause a fault.
-
- It results in undefined behaviour. Generating a fault is one possibility but
- there are an almost limitless supply of others. printf is a variadic function
- which means it is illegal to call it without a prototype in scope (e.g.
- by including stdio.h). If there was a prototype in scope the compiler would
- have generated a diagnostic for this.
-
- > What you probably want to do is omit
- >the dereference and use printf(input).
-
- Unless he wanted:
-
- putchar(*input);
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-